﻿using Syngine.Controls;

namespace Syngine.Components.Screens
{
	/// <summary>
	/// 
	/// </summary>
	public abstract class Screen : Control
	{
		protected Screen() : this(GameContext.ScreenController)
		{
		}

		protected Screen(ScreenController screenController)
		{
			ScreenController = screenController;
		}

		/// <summary>
		/// Gets or sets a value indicating whether this instance is exiting.
		/// </summary>
		/// <value><c>true</c> if this instance is exiting; otherwise, <c>false</c>.</value>
		public bool IsExiting { get; protected set; }

		/// <summary>
		/// 
		/// </summary>
		public bool IsActive
		{
			get
			{
				return Visible && Enabled;
			}
		}

		/// <summary>
		/// Gets or sets the duration of the transition in.
		/// </summary>
		/// <value>The duration of the transition in.</value>
		public float TransitionInDuration { get; set; }

		/// <summary>
		/// Gets or sets the duration of the transition out.
		/// </summary>
		/// <value>The duration of the transition out.</value>
		public float TransitionOutDuration { get; set; }

		protected ScreenController ScreenController { get; private set; }

		/// <summary>
		/// Exits this instance.
		/// </summary>
		public void Exit()
		{
			IsExiting = true;
		}

		/// <summary>
		/// Shows this instance.
		/// </summary>
		public void Show()
		{
			Visible = true;
		}

		/// <summary>
		/// Hides this instance.
		/// </summary>
		public void Hide()
		{
			Visible = false;
		}
	}
}